package com.example.demo.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@ConfigurationProperties(prefix = "myconfig")
@Data
public class MyConfig {
    private static String imgType;
    private static String videoType;
    private static String fileType;
    private static String domain;
    private static String basePath;
    private static String storagePath;
    private static String filePatterns;
    private static String expireTime;

    public void setFileType(String fileType){
        MyConfig.fileType = fileType;
    }

    public static List<String> getFileType() {
        return List.of(fileType.split(";"));
    }

    public void setImgType(String imgType){
        MyConfig.imgType = imgType;
    }

    public static List<String> getImgType() {
        return List.of(imgType.split(";"));
    }

    public void setVideoType(String videoType){
        MyConfig.videoType = videoType;
    }

    public static List<String> getVideoType() {
        return List.of(videoType.split(";"));
    }

    public void setDomain(String domain){
        MyConfig.domain = domain;
    }

    public static String getDomain(){
        return MyConfig.domain;
    }

    public static String getBasePath() {
        return MyConfig.basePath;
    }

    public static void setBasePath(String basePath) {
        MyConfig.basePath = basePath;
    }

    public static String getStoragePath() {
        return MyConfig.storagePath;
    }

    public void setStoragePath(String storagePath) {
        MyConfig.storagePath = storagePath;
    }

    public void setFilePatterns(String filePatterns){
        MyConfig.filePatterns = filePatterns;
    }

    public static String getFilePatterns(){
        return MyConfig.filePatterns;
    }

    public static long getExpireTime() {
        return Long.parseLong(expireTime);
    }

    public void setExpireTime(String expireTime) {
        MyConfig.expireTime = expireTime;
    }
}
